/*
 * This file is part of Cadmium.
 * Copyright (C) 2007-2010 Xavier Clerc.
 *
 * Cadmium is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Cadmium is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package fr.x9c.cadmium.support.values;

import fr.x9c.cadmium.kernel.Fail;

/**
 * This class provides methods to raise exceptions.
 *
 * @author <a href="mailto:cadmium@x9c.fr">Xavier Clerc</a>
 * @version 1.0
 * @since 1.0
 */
public final class Exceptions {

    /**
     * No instance of this class.
     */
    private Exceptions() {
    } // end empty constructor

    /**
     * Raises a 'Failure' exception.
     * @param s exception parameter - should not be <tt>null</tt>
     * @throws Fail.Exception always
     */
    public static void failWith(final String s) throws Fail.Exception {
        assert s != null : "null s";
        Fail.failWith(s);
    } // end method 'failWith(String)'

    /**
     * Raises an 'Invalid_argument' exception.
     * @param s exception parameter - should not be <tt>null</tt>
     * @throws Fail.Exception always
     */
    public static void invalidArgument(final String s) throws Fail.Exception {
        assert s != null : "null s";
        Fail.invalidArgument(s);
    } // end method 'invalidArgument(String)'

    /**
     * Raises an 'End_of_file' exception.
     * @throws Fail.Exception always
     */
    public static void raiseEndOfFile() throws Fail.Exception {
        Fail.raiseEndOfFile();
    } // end method 'raiseEndOfFile()'

    /**
     * Raises a 'Not_found' exception.
     * @throws Fail.Exception always
     */
    public static void raiseNotFound() throws Fail.Exception {
        Fail.raiseNotFound();
    } // end method 'raiseNotFound()'

    /**
     * Raises an 'Out_of_memory' exception.
     * @throws Fail.Exception always
     */
    public static void raiseOutOfMemory() throws Fail.Exception {
        Fail.raiseOutOfMemory();
    } // end method 'raiseOutOfMemory()'

    /**
     * Raises a 'Stack_overflow' exception.
     * @throws Fail.Exception always
     */
    public static void raiseStackOverflow() throws Fail.Exception {
        Fail.raiseStackOverflow();
    } // end method 'raiseStackOverflow()'

    /**
     * Raises a 'Sys_blocked_io' exception.
     * @throws Fail.Exception always
     */
    public static void raiseSysBlockedIO() throws Fail.Exception {
        Fail.raiseSysBlockedIO();
    } // end method 'raiseSysBlockedIO()'

    /**
     * Raises a 'Sys_error' exception.
     * @param s exception parameter - should not be <tt>null</tt>
     * @throws Fail.Exception always
     */
    public static void raiseSysError(final String s) throws Fail.Exception {
        assert s != null : "null s";
        Fail.raiseSysError(s);
    } // end method 'raiseSysError(String)'

    /**
     * Raises a 'Division_by_zero' exception.
     * @throws Fail.Exception always
     */
    public static void raiseZeroDivide() throws Fail.Exception {
        Fail.raiseZeroDivide();
    } // end method 'raiseZeroDivide()'

} // end class 'Exceptions'
